var fectureArray=new Array();
fectureArray=["请选择"];

function selectAll(){
	var checkall = document.getElementById('checkall');
	var listsize = document.getElementById('listsize').value;
	for(var i=0;i<listsize;i++){
		if(checkall.checked){
			document.getElementById('checkone'+i).checked = true;
		}else{
			document.getElementById('checkone'+i).checked = false;
		}
	}
}


function searchForm(){	  
		var ch_attr  ="";
		if(document.getElementById("sort1").value!="")
	  {
		  ch_attr = document.getElementById("sort1").value+"|"; 
	  }

	  if(document.getElementById("sort2").value!="")
	  {
		  ch_attr += document.getElementById("sort2").value+"|"; 
	  }

	  if(document.getElementById("sort3").value!="")
	  {
		  ch_attr += document.getElementById("sort3").value+"|"; 
	  }
	  document.getElementById("s_ch_attr").value=trim(ch_attr);
		document.indexForm.submit();
}

// 设置二级分类
function setSecondClass(val) {
	var up_class_id = val;
	Ti_aboutchannelInfo.getAbClassByUpId(up_class_id, setSort2);
}

function setSort2(map_data) {
	
	DWRUtil.removeAllOptions("sort2");
	DWRUtil.addOptions('sort2',{'':'请选择'});
	DWRUtil.addOptions("sort2", map_data);
	$("sort3").style.display = "none";
	var item = $("sort2").length;
	if (item == 0) {
		$("sort2").style.display = "none";
	} else {
		$("sort2").style.display = "inline";
	}
}
// 设置三级分类
function setTherdClass(val) {
	var up_class_id = val;
	Ti_aboutchannelInfo.getAbClassByUpId(up_class_id, setSort3);
}
function setSort3(map_data) {
  
	if (map_data != null) {
		DWRUtil.removeAllOptions("sort3");
		DWRUtil.addOptions('sort3',{'':'请选择'});
		DWRUtil.addOptions("sort3", map_data);
		var item = $("sort3").length;
		if (item == 0) {
			$("sort3").style.display = "none";
		} else {
			$("sort3").style.display = "inline";
		}
	}
}

function trim(str){
    return str.replace(/(^\s*)|(\s*$)/g,"");
}//去掉空格

function chekedform() {
	var title1=document.getElementById("title").value;
	if(trim(title1)==''){
		alert('信息标题不能为空');
		document.getElementById('title').focus();
		return false;
		}
	var str=CKEDITOR.instances.content.getData();
		str=str.replace("<br />","");
   	str=str.replace("<br>","");
   	str=trim(str);
    if(trim(str)==""){
    	alert("内容不能为空!");
    	CKEDITOR.instances.content.focus();
			return false;
		}
		var ch_attr  ="";
		if(document.getElementById("sort1").value!="")
	  {
		  ch_attr = document.getElementById("sort1").value+"|"; 
	  }

	  if(document.getElementById("sort2").value!="")
	  {
		  ch_attr += document.getElementById("sort2").value+"|"; 
	  }

	  if(document.getElementById("sort3").value!="")
	  {
		  ch_attr += document.getElementById("sort3").value+"|"; 
	  }
	 
	  if(ch_attr=="")
	  {
	  	alert("请选择栏目 ");
		  return false;
	  }
	  document.getElementById("ch_attr").value=trim(ch_attr);
	  
	  document.addForm.submit();
}

function checkUpdateForm() {
	var title1=document.getElementById("title").value;
	if(trim(title1)==''){
		alert('信息标题不能为空');
		document.getElementById('title').focus();
		return false;
		}
	var str=CKEDITOR.instances.content.getData();
		str=str.replace("<br />","");
   	str=str.replace("<br>","");
   	str=trim(str);
    if(trim(str)==""){
    	alert("内容不能为空!");
    	CKEDITOR.instances.content.focus();
			return false;
		}
		
		
		
		var ch_attr  ="";
		if(document.getElementById("sort1").value!="")
	  {
		  ch_attr = document.getElementById("sort1").value+"|"; 
	  }

	  if(document.getElementById("sort2").value!="")
	  {
		  ch_attr += document.getElementById("sort2").value+"|"; 
	  }

	  if(document.getElementById("sort3").value!="")
	  {
		  ch_attr += document.getElementById("sort3").value+"|"; 
	  }
	
	  if(ch_attr=="")
	  {
		document.getElementById('ch_attr').value = document.getElementById('ch_attr_bak').value;
	  }else{
	  	document.getElementById('ch_attr').value=trim(ch_attr);
	  	}
	  
	  document.updateForm.submit();
}

function ChangeOrg(){
	document.getElementById('org1').style.display = 'none';
	document.getElementById('org2').style.display = 'inline';
}

//限制数字全角状态输入 允许中文输入
function   clearSBC(){ 
window.clipboardData.setData( 'text ',clipboardData.getData( 'text ').replace(/[\uFF00-\uFFFF]/g, ' ')) 
} 